package com.senthink.gl.business.domain.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.senthink.gl.business.common.entity.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.PrePersist;
import javax.persistence.Table;
import java.util.Date;

/**
 * 操作日志实体类
 * @author yuanpeng@senthink.com
 * @data 2018-01-31 16:31
 */

@Entity
@Table(name = "gl_user_log")
@Getter
@Setter
public class UserLog extends BaseEntity<Long> {

    /**
     * 用户唯一业务ID
     */
    private String uid;

    /**
     * 操作类型
     */
    private String operate;

    /**
     * 操作详情
     */
    private String details;

    /**
     * 角色
     */
    private String role;

    /**
     * ip地址
     */
    private String ip;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "create_time")
    protected Date createTime;

    @PrePersist
    protected void onCreate() {
        createTime = new Date();
    }
}
